//
//  DYIssueCardsFooterView.m
//  kafuMerchant
//
//  Created by 帝云科技 on 2018/9/21.
//  Copyright © 2018年 帝云科技. All rights reserved.
//

#import "DYIssueCardsFooterView.h"

@interface DYIssueCardsFooterView ()

@property (nonatomic,strong)UILabel *tipLabel;
@property (nonatomic,strong)UIButton *agreementButton;
@property (nonatomic,strong)UIButton *submitButton;

@end

@implementation DYIssueCardsFooterView

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self=[super initWithFrame:frame]) {
        [self initView];
    }
    return self;
}
-(void)initView
{
    self.backgroundColor=WhiteColor;
    
    self.tipLabel =({
        UILabel *label=[Utils labelWithTitle:@"提交即表示同意" titleFontSize:14 textColor:[UIColor xhq_content] backgroundColor:WhiteColor alignment:0];
        label;
    });
    
    self.submitButton =({
        UIButton * button=[Utils createBtnWithType:UIButtonTypeCustom backgroundColor:[UIColor xhq_base] action:@selector(buttonClick:) target:self title:@"提交审核" image:@"icon_login" font:17 textColor:WhiteColor];
        [button xhq_cornerRadius:BILIHEIGHT(19)];
        button;
    });
    
    self.agreementButton =({
        UIButton * button=[Utils createBtnWithType:UIButtonTypeCustom backgroundColor:WhiteColor action:@selector(buttonClick:) target:self title:@"《发卡协议》" image:nil font:14 textColor:[UIColor xhq_base]];
        button;
    });
    
    [self addSubview:self.tipLabel];
    [self addSubview:self.submitButton];
    [self addSubview:self.agreementButton];
    
    [self.submitButton makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(BILIHEIGHT(30));
        make.right.equalTo(BILIWIDTH(-10));
        make.size.equalTo(CGSizeMake(BILIWIDTH(132), BILIHEIGHT(38)));
    }];
    
    [self.tipLabel makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.submitButton.bottom).offset(BILIHEIGHT(40));
        make.left.equalTo(BILIWIDTH(100));
    }];
    
    [self.agreementButton makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.tipLabel.right).offset(BILIWIDTH(5));
        make.centerY.equalTo(self.tipLabel);
    }];
    
    
    [self.submitButton placeImageTitlePosition: ZYButtonImagePositionRight space:BILIWIDTH(10)];
}
-(void)buttonClick:(UIButton *)button
{
    if (button==self.agreementButton) {
        !self.agreementBlock?:self.agreementBlock();
    }else{
        !self.submitBlock?:self.submitBlock();
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
